package com.xxzuibang.day16.arrays类;

import java.util.Arrays;

public class ArrayExercise {
    public static void main(String[] args) {
        Book[] books = new Book[4];
        books[0] = new Book("红楼梦", 100.0);
        books[1] = new Book("金瓶梅新", 89.0);
        books[2] = new Book("青年文摘20年", 40.0);
        books[3] = new Book("java从入门到精通~", 108.0);
        //按照书名长度降序排序
        Arrays.sort(books,(o1,o2)->(o2.getName().length()-o1.getName().length()));
        System.out.println(Arrays.toString(books)+" ");
    }
}
